package org.jsbd.boss.service;

import org.jsbd.boss.service.impl.CacheParamManager;
import org.jsbd.boss.util.CacheKey;
import org.slf4j.Logger;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.Serializable;

/**
 * @desc
 * @Date 2018/11/10 09:56
 * @Author xupengcheng [xupengcheng@zhexinit.com]
 */

@Service
public class LogManager implements Serializable{

    private static final long serialVersionUID = 1L;

    @Resource
    private CacheParamManager cacheParamManager;


    public void printLog(Logger logger, String logRule,  Object[] objects){

        Object paramValue = cacheParamManager.getParamValue(CacheKey.LOG_FLAG);
        if(paramValue != null && "1".equals(paramValue)){
            logger.warn(logRule, objects);
        }
    }
}
